/**
 * 查看已投放视频广告
 */
		var translate = function(t){
			 t = t.split(" ")[0];	
			 t=t.replace("-","年");
			 t=t.replace("-","月");
			 return t;
		};


var LocString=String(window.document.location.href);
 function GetQueryString(str){
	 var rs=new RegExp("(^|)"+str+"=([^&]*)(&|$)","gi").exec(LocString),tmp;
	 if(tmp=rs)return tmp[2];
	 return "没有这个参数";
 }//获取url中的数据
var vedioSaveUrl = "http://114.116.41.171:8089/videos/";//服务器保存视频的路径
var pictureSaveUrl = "http://114.116.41.171:8089/pictures/";//服务器保存图片的路径
//var vedioSaveUrl = "http://192.168.3.67:8089/videos/";//服务器保存视频的路径
//var pictureSaveUrl = "http://192.168.3.67:8089/pictures/";//服务器保存图片的路径
function queryVedioAd(){
	var adId = GetQueryString("adId");
	
	$.ajax({
		url : '/Lvscore_Advertiser_Maven/viewPlacementAd',
        data:{adId:adId},
		type : 'post',
		success : function(data) {
//			var resultVo = data.resultVo;
//			var picServerPrex = resultVo.picServerPrex;
//			var ads = data.bean;
//			$("#adName").html(ads.adName);	
//			$(".adCoverImg").attr("src",picServerPrex+ads.adHomepage);
			var beans = data.beans;
			var type = beans[0].deliveryCarrier;
			$("#time").text(translate(beans[0].starTime)+"日"+"--"+translate(beans[0].endTime)+"日");
			$("#adName").text(beans[0].adName);
			$("#adImage").attr("src",pictureSaveUrl+beans[0].adHomepage);
			$("#adReleaseAmount").text(beans[0].releaseAmount+"(元)");
			$("#adDeliveryPrice").text(beans[0].deliveryPrice+"(次/元)");
			$("#adImageHome").prop("value",pictureSaveUrl+beans[0].adHomepage);
			$("#adLunBoImg").prop("value",vedioSaveUrl+beans[0].lastUrl);
			$("#typeImage").text(beans[0].deliveryCarrier);
			$("#idLogo").attr("src",pictureSaveUrl+beans[0].adHomepage);
			if(type=='pad'){
				$("#typeImg").prop("src","/Lvscore_Advertiser_Maven/advertiserWeb/static/images/padIcon.png");
		       }
		       if(type=='pc'){
		    	   $("#typeImg").prop("src","/Lvscore_Advertiser_Maven/advertiserWeb/static/images/pcIcon.png");
		       }
		       if(type=='mobile'){
		    	   $("#typeImg").prop("src","/Lvscore_Advertiser_Maven/advertiserWeb/static/images/mobileIcon.png");
		       }
		       if(type=='tv'){
		    	   $("#typeImg").prop("src","/Lvscore_Advertiser_Maven/advertiserWeb/static/images/tvIcon.png");
		       }
			for(var j = 0;j<beans.length;j++){
				if(beans[j].channelName!=null){
					var li = "<li><img class='left' src='"+pictureSaveUrl+beans[j].logoUrl+"' alt=''>" +
					"<button class='btn btn-primary left'>"+beans[j].channelName+"</button>" +
					"<div class='right'><p><span>" +
					"投放金额：</span><span>"+beans[j].channelAmount+"(元)</span></p>\<p>" +
					"<span>投放单价：</span><span>"+beans[j].channelPrice+"(次/元)</span></p></div>" +
					"<div class='clear'></div></li>";
					$("#placement").append(li);
				}
			}
			//广告属性标签
			var classfyIds = beans[0].adClassify.split("|");
			for(var i =0;i<classfyIds.length;i++){
				if(classfyIds[i].length != 0){
				//	console.log(classfyIds[i]);
					var li = "<li><img src=\"/Lvscore_Advertiser_Maven/advertiserWeb/static/images/genres_pic"+classfyIds[i]+".png\" alt=\"\" /></li>";
					$("#adClassify").append(li);
				}
			}
		},
        error: function(){}        
	});
}

/**
 * 查看
 */
flashImg.loadingVideo=function(){
	var vedioUrl = $("#adLunBoImg").val();
	var vedioPageUrl = $("#adImageHome").val();
	 var flashvars={
        f:vedioUrl,//视频url
        c:0,
        b:1, 
        i:vedioPageUrl, //视频封面url
	     my_url:window.location.href  //分享地址
    };
    var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
    CKobject.embedSWF('/Lvscore_Advertiser_Maven/advertiserWeb/static/vendor/ckplayer/ckplayer.swf','flashVideoBox','ckplayer_a1','100%','100%',flashvars,params);
};

flashImg.closeVideo=function(ele){				     
    ele.siblings("div#flashVideoBox").empty();									 
};

